# 遍历0到100的所有数字（包含100）
for num in range(101):
    # 检查是否包含数字7或能被7整除
    has_seven = '7' in str(num)  # 判断数字中是否有7
    divisible_by_seven = num % 7 == 0  # 判断是否能被7整除
    
    if has_seven or divisible_by_seven:
        print(num)
import tkinter as tk
from tkinter import messagebox

class GobangGame:
    def __init__(self, root):
        self.root = root
        self.root.title("五子棋")
        self.root.resizable(False, False)
        
        # 棋盘大小（15x15）
        self.size = 15
        # 每个格子的大小（像素）
        self.cell_size = 40
        # 棋子颜色
        self.black = "black"
        self.white = "white"
        # 当前玩家（黑棋先行）
        self.current_player = self.black
        # 棋盘状态记录
        self.board = [[None for _ in range(self.size)] for _ in range(self.size)]
        
        # 创建画布
        self.canvas = tk.Canvas(
            root,
            width=self.size * self.cell_size,
            height=self.size * self.cell_size,
            bg="#E6B89C"  # 棋盘底色（木色）
        )
        self.canvas.pack(padx=10, pady=10)
        
        # 创建按钮
        self.reset_btn = tk.Button(root, text="重新开始", command=self.reset_game)
        self.reset_btn.pack(pady=5)
        
        # 绘制棋盘
        self.draw_board()
        
        # 绑定鼠标点击事件
        self.canvas.bind("<Button-1>", self.place_stone)
    
    def draw_board(self):
        """绘制15x15的棋盘网格"""
        for i in range(self.size):
            # 横线
            self.canvas.create_line(
                self.cell_size // 2,
                self.cell_size // 2 + i * self.cell_size,
                (self.size - 1) * self.cell_size + self.cell_size // 2,
                self.cell_size // 2 + i * self.cell_size,
                width=2
            )
            # 竖线
            self.canvas.create_line(
                self.cell_size // 2 + i * self.cell_size,
                self.cell_size // 2,
                self.cell_size // 2 + i * self.cell_size,
                (self.size - 1) * self.cell_size + self.cell_size // 2,
                width=2
            )
        
        # 绘制天元和星位
        star_points = [(3, 3), (3, 11), (7, 7), (11, 3), (11, 11)]
        for x, y in star_points:
            self.canvas.create_oval(
                self.cell_size // 2 + x * self.cell_size - 5,
                self.cell_size // 2 + y * self.cell_size - 5,
                self.cell_size // 2 + x * self.cell_size + 5,
                self.cell_size // 2 + y * self.cell_size + 5,
                fill="black"
            )
    
    def place_stone(self, event):
        """在点击位置放置棋子"""
        # 计算落子坐标
        x = round((event.x - self.cell_size // 2) / self.cell_size)
        y = round((event.y - self.cell_size // 2) / self.cell_size)
        
        # 检查坐标是否在棋盘范围内且该位置为空
        if 0 <= x < self.size and 0 <= y < self.size and not self.board[y][x]:
            # 记录棋子位置
            self.board[y][x] = self.current_player
            
            # 绘制棋子
            center_x = self.cell_size // 2 + x * self.cell_size
            center_y = self.cell_size // 2 + y * self.cell_size
            self.canvas.create_oval(
                center_x - self.cell_size // 2 + 2,
                center_y - self.cell_size // 2 + 2,
                center_x + self.cell_size // 2 - 2,
                center_y + self.cell_size // 2 - 2,
                fill=self.current_player,
                outline="black" if self.current_player == self.white else ""
            )
            
            # 检查是否获胜
            if self.check_win(x, y):
                winner = "黑棋" if self.current_player == self.black else "白棋"
                messagebox.showinfo("游戏结束", f"{winner}获胜！")
                self.canvas.unbind("<Button-1>")
                return
            
            # 切换玩家
            self.current_player = self.white if self.current_player == self.black else self.black
    
    def check_win(self, x, y):
        """检查是否有一方获胜（五子连珠）"""
        color = self.board[y][x]
        
        # 检查方向：水平、垂直、左斜、右斜
        directions = [
            [(1, 0), (-1, 0)],   # 水平
            [(0, 1), (0, -1)],   # 垂直
            [(1, 1), (-1, -1)],  # 右斜
            [(1, -1), (-1, 1)]   # 左斜
        ]
        
        for dir_pair in directions:
            count = 1  # 初始化为1，包含当前落子
            
            # 检查每个方向的两个方向
            for dx, dy in dir_pair:
                nx, ny = x + dx, y + dy
                while 0 <= nx < self.size and 0 <= ny < self.size and self.board[ny][nx] == color:
                    count += 1
                    nx += dx
                    ny += dy
            
            # 五子连珠则获胜
            if count >= 5:
                return True
        
        return False
    
    def reset_game(self):
        """重置游戏"""
        self.canvas.delete("all")
        self.board = [[None for _ in range(self.size)] for _ in range(self.size)]
        self.current_player = self.black
        self.draw_board()
        self.canvas.bind("<Button-1>", self.place_stone)

if __name__ == "__main__":
    root = tk.Tk()
    game = GobangGame(root)
    root.mainloop()

    